package com.ruoyi.hr.personalFile.domain;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ruoyi.api.apkVersion.entity.DateUtil;
import lombok.Data;

import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;

@Data
public class Family {
  private String familyName;//联系人
  private String relation;//关系
  @JsonFormat(pattern = "yyyy-MM-dd")
  private Date bornDate;//出生年月
  private String phone;//成员电话
  private String workUnit;//工作单位
  private String workDuty;//职位

  public static void main(String[] args) {
    Family family=new Family();
    family.setFamilyName("张大大");
    family.setRelation("父亲");
    family.setBornDate(new Date());
    family.setPhone("13456448899");
    family.setWorkDuty("务农");
    family.setWorkUnit("务农");
    List<Family> list=new ArrayList<>();
    list.add(family);
    try {
      System.out.println(JSON.toJSONString(list));
      String s = DatatypeConverter.printBase64Binary(JSON.toJSONString(list).getBytes("utf-8"));
      System.out.println(s);
      System.out.println(new String(DatatypeConverter.parseBase64Binary(s),"utf-8"));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
